<?php
/**
 * Created by PhpStorm.
 * User: qzy008
 * Date: 2018/9/11
 * Time: 15:58
 */

namespace app\api\validate\admin;

use app\common\validate\BaseValidate;

class AdminCreateOrEdit extends BaseValidate
{
    protected $rule = [
        'id' => 'require|isPositiveInteger',
        'name' => 'require|min:2',
        'email' => 'require|email',
        'phone' => 'require|isPhone',
        'password' => 'require|isPassword'
    ];
    protected $message = [
        'id' => 'id必须是正整数',
        'name' => '名称不得少于两位',
        'password' => '密码必须是由8-20位的字母和数字组成',
        'email' => '邮箱格式不正确',
        'phone' => '手机号码不正确'
    ];
    protected $scene = [
        'create' => [
            'name' => 'require|min:2',
            'email' => 'require|email',
            'phone' => 'require|isPhone',
            'password' => 'require|isPassword'
        ]
    ];
}